home *** CD-ROM | disk | FTP | other *** search
- Path: news.netins.net!trg1
- From: hhowe@trgnet.com (Harold Howe)
- Newsgroups: comp.lang.c++
- Subject: Re: Object constuction in function call.
- Date: Tue, 19 Mar 96 02:15:18 GMT
- Organization: Technology Resource Group
- Message-ID: <4il8ln$2vi@insosf1.netins.net>
- References: <4icmqh$8g6@insosf1.netins.net> <4ie16n$pc1@sam.inforamp.net>
- NNTP-Posting-Host: desm-22-13.dialup.netins.net
- X-Newsreader: News Xpress Version 1.0 Beta #3
-
-
- >The TCorners that you declare in main() are destroyed when you exit main.
- >Thus at the end of your program you have 0 objects. Here's a procedure look
- >at what is happening.
- >
- >int main(void)
- >{
- > construct TCorners
- > display TCorners
- > construct TCorners
- > display TCorners
- > construct TCorners
- > display TCorners
- > destroy TCorners
- > destroy TCorners
- > destroy TCorners
- >};
- >
- >when the TCorners lose scope, then the destroy themselves.
- >
- >Agrivar
-
- Thank you for responding. To all who read my post, I apologize for a huge
- ambiguity on my part. I meant to ask how many objects exist just before main
- terminates. In other words does the object that was created in the call to
- display_coordinates exist when display_coordinates returns back to main?
- According to Agrivar's followup, they exist until main ends, and are not
- destroyed when display_coordinates returns.
-
- >>int main(void)
- >> {
- >> display_coordinates(TCorners(1,1,20,10));
- >> display_coordinates(TCorners(1,5,25,15));
- >> display_coordinates(TCorners(2,5,20,10));
- >> }
-
- Harold Howe
- hhowe@trgnet.com
-